<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">

    //    var num  =parseInt (prompt("请输入一个数"));
    //    匿名函数表达式
    //  function name(num) {
    //     var res=1;//定义积
    //     for (let i = 1; i <=num; i++) {
    //         res*=i;
    //     }
    //     return res;
    // }
    // var res=name(num);
    // console.log(res);
    function fn() {
        //arguments:只有长度，只能找到下标和元素
        console.log(arguments);
    }



    fn(1,2,3,5,6,7,8,9,0)
    //1.将数组map，filter，reduce，every改写成箭头函数形式

    const arr = [1, 2, 3, 4, 5, 6]



    const arr1 = arr.map(
    function (element) {
        return element + 1
    }
)
 const new_arr = arr.filter(
            function (e){
                return e%2==0  //true：返回 false：不符合条件=>过滤
            }
        )

 var sum = arr.reduce(
            function (v1,v2){
                return v1*v2
            }
        )

var isMatch = arr.every(
            function (e){
                return e>1
            }
        )
        // 使用箭头函数实现
        let result1 = arr.map(element => element + 2);
let result2 = arr.filter(e=>  e%2==0);
let result4 =arr.reduce((v1,v2) => v1*v2);
let result3 = arr.every(e=> e>0);
console.log(result2);
console.log(result3);
console.log(result1);
console.log(result4);
    </script>
    
</body>
</html>